<template>
	<view class="container">
		<image src="/static/images/img3.png" mode="widthFix" class="bg"></image>
		<div class="mainT">
			<image :src="info.info.avatar" mode="aspectFill" class="avatar"></image>
			<div class="r">
				<div class="info">
					<p class="name">{{info.info.nickname}}</p>
					<p class="type">
						{{info.info.type_name}}
					</p>
				</div>
			</div>
		</div>
		<div class="zcxx">
			<h3 class="title">资产信息</h3>
			<div class="list">
				<div class="items">
					<h3>储值金额</h3>
					<p>¥{{info.recharge_amount}}</p>
				</div>
				<div class="items">
					<h3>会员卡</h3>
					<p>{{info.vip_card}}张</p>
				</div>
			</div>
		</div>
		<div class="jytj">
			<h3 class="title">交易统计</h3>
			<div class="list">
				<div class="items">
					<h3>付款金额</h3>
					<p>¥{{info.pay_amount}}</p>
				</div>
				<div class="items">
					<h3>付款订单总数</h3>
					<p>{{info.order_num}}</p>
				</div>
				<div class="items">
					<h3>订单均价</h3>
					<p>¥{{info.average}}</p>
				</div>
				<div class="items">
					<h3>最近消费</h3>
					<p>{{info.buy_time}}</p>
				</div>
			</div>
		</div>
		<div class="vipInfo">
			<h3 class="title">会员信息</h3>
			<div class="list">
				<div class="items">
					<p>手机号</p>
					<p>{{info.info.mobile}}</p>
				</div>
				<!-- <div class="items">
					<p>账号</p>
					<p>{{info.info.mobile}}</p>
				</div>
				<div class="items">
					<p>邮箱</p>
					<p>-</p>
				</div> -->
				<div class="items">
					<p>注册时间</p>
					<p>-</p>
				</div>
				<div class="items">
					<p>身份</p>
					<p>{{info.info.type_name}}</p>
				</div>
				<div class="items" v-if="info.invite">
					<p>会员上级</p>
					<p>{{info.invite.name}}</p>
				</div>
			</div>
		</div>
	</view>
</template>

<script>
	import {
		request
	} from '@/utils/request.js'
	export default {
		data() {
			return {
			info:{},
			}
		},
		onLoad(options) {
			console.log(options)
			this.getInfo(options.id)
		},
		methods: {
					async getInfo(id){
						try{
							const res = await request({
							url: 'user/user-view',
							method: 'get',
							data: {
								id:id
							}
						})
						console.log(res)
						this.info = res.data
						}
						catch(error){
							
						}
						
					}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f2f2f2;
	}

	.bg {
		width: 100%;
		display: block;
		position: absolute;
		z-index: -1;
	}

	.mainT {
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 0 50rpx;
		padding-top: 45rpx;
		padding-bottom: 25rpx;

		.avatar {
			width: 115rpx;
			height: 115rpx;
			border-radius: 100%;
			display: block;
		}

		.r {
			margin-left: 30rpx;
		}

		.info {
			display: flex;
			align-items: center;

			.name {
				color: #000;
				font-size: 28rpx;
			}

			.type {
				margin-left: 20rpx;

				image {
					width: 26rpx;
					height: 26rpx;
					display: block;
					margin-right: 5rpx;
				}

				min-width: 128rpx;
				padding: 0 10rpx;
				height: 38rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				line-height: 1;
				border-radius: 16rpx;
				font-size: 24rpx;
				background-color: #c3eff1;
				color: #18c2c9;
			}

		}
	}

	.jytj {
		width: 715rpx;
		background-color: #fff;
		margin: 0 auto;
		box-sizing: border-box;
		border-radius: 10rpx;
		padding: 0 22rpx;

		.title {
			color: #414141;
			font-size: 32rpx;
			line-height: 100rpx;
		}

		.list {
			display: flex;
			flex-wrap: wrap;
			padding: 0 35rpx;
			padding-bottom: 1rpx;

			.items {
				width: 50%;
				margin-bottom: 30rpx;
			}

			h3 {
				color: #898888;
				font-size: 28rpx;
				margin-bottom: 30rpx;
			}

			p {
				font-size: 28rpx;
				color: #333;
			}
		}
	}
.zcxx{
	width: 715rpx;
	background-color: #fff;
	margin: 0 auto;
	box-sizing: border-box;
	border-radius: 10rpx;
	padding: 0 22rpx;
	margin-bottom: 25rpx;
	.title {
		color: #414141;
		font-size: 32rpx;
		line-height: 100rpx;
	}
	.list {
		display: flex;
		flex-wrap: wrap;
		.items {
			width: 50%;
			margin-bottom: 30rpx;
			text-align: center;
		}
	
		h3 {
			color: #898888;
			font-size: 28rpx;
			margin-bottom: 30rpx;
		}
	
		p {
			font-size: 28rpx;
			color: #333;
		}
	}
}
.vipInfo{
	width: 715rpx;
	background-color: #fff;
	margin: 0 auto;
	box-sizing: border-box;
	border-radius: 10rpx;
	padding: 0 22rpx;
	margin-top: 25rpx;
	padding-bottom: 25rpx;
	.title {
		color: #414141;
		font-size: 32rpx;
		line-height: 100rpx;
		border-bottom: 1px solid #eee;
	}
	.items{
		display: flex;
		justify-content: space-between;
		height: 95rpx;
		align-items: center;
		font-size: 28rpx;
	}
}
	.container {
		// background: url(/static/images/img3.png) no-repeat;
		// background-size: 100%;
		// height: 100vh;
	}
</style>